//
//  JQFYMusicGenreCollectionViewCell.m
//  JQFY
//
//  Created by 代辉 on 2017/10/30.
//  Copyright © 2017年 yannis. All rights reserved.
//

#import "JQFYMusicGenreCollectionViewCell.h"

@implementation JQFYMusicGenreCollectionViewCell {
    UIImageView *_songCover;
    UILabel *_songName;
}

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self setupUI];
    }
    return self;
}

- (void)setupUI
{
    self.backgroundColor = [UIColor clearColor];
    _songCover = [UIImageView new];
    _songCover.layer.cornerRadius = 5 *SCAL;
    _songCover.layer.masksToBounds = YES;
    [self.contentView addSubview:_songCover];
    [_songCover mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(0 *SCAL);
        make.top.right.bottom.equalTo(self.contentView);
    }];
    
    _songName = [UILabel new];
    _songName.textColor = [UIColor whiteColor];
    _songName.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:_songName];
    [_songName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self);
        make.width.mas_equalTo(80 *SCAL);
    }];

}
- (void)setSongInfo:(JQFYSong *)songInfo
{
    _songInfo = songInfo;
    _songName.text = songInfo.music_name;
    [_songCover sd_setImageWithURL:[NSURL URLWithString:songInfo.music_cover_path] placeholderImage:[UIImage imageNamed:@"2（合并）"]];
}
@end
